<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>报表打印列表</title>

    <!--引入本地 element-ui 的样式，-->
    <link rel="stylesheet" href="/admin/plugin/element-ui/index.css">
    <script type="text/javascript" src="/admin/js-css/js/vue.min.js"></script>
    <script type="text/javascript" src="/admin/plugin/element-ui/index.js"></script>

    <!--    引入Layui组件-->
    <link rel="stylesheet" href="/admin/plugin/layui/dist/css/layui.css" tppabs="http://res.layui.com/layui/dist/css/layui.css"  media="all">
    <script src="/admin/plugin/layui/dist/layui.js" charset="utf-8"></script>

    <script type="text/javascript" src="/admin/js-css/js/jquery-1.7.2.min.js"></script>
    <script type="text/javascript" src="/admin/js-css/js/mx1.0.js?v=1.1.1"></script>
    <script type="text/javascript" src="/admin/html/module/yumenyoutian/js/api.js"></script>

    <style>
        .line {
            text-align: center;
        }
        table {
            border: 1px solid #ebeef5;
        }
        th {
            color: #606266;
            background: #f5f7fa;
            border: 1px solid #ebeef5;
        }
        td {
            border: 1px solid #ebeef5;
            color: #606266;
            text-align: center;
        }
        td.nopadding {
            padding: 0;
        }
        .nopadding .left {
            width: 50px !important;
            text-align: left;
        }
        .nopadding .right {
            width: 100px !important;
            text-align: left;
        }
        #lineTd {
            background: #f5f7fa
            url()
            no-repeat 100% center;
            display: flex;
            justify-content: space-around;
        }
    </style>
</head>
<body>

    <div id="app" style="padding: 15px 3px;">
        <template>
            <div class="app-container">

                <!-- 查询表单 -->
                <el-form
                        :inline="true"
                        size="small"
                        :model="formData"
                        class="demo-form-inline"
                >
                    <el-form-item label="报表类别" style="display: none;">
                        <el-select
                                v-model="formData.bblx"
                                @change="choosebblx"
                                placeholder="请选择"
                        >
                            <el-option
                                    v-for="item in options"
                                    :key="item.code_value"
                                    :label="item.code_name"
                                    :value="item.code_value"
                            ></el-option>
                        </el-select>
                    </el-form-item>
                    <el-form-item label="所属期" v-if="showmonth">
                        <el-date-picker
                                type="month"
                                placeholder="选择年月"
                                v-model="formData.month"
                                style="width: 100%"
                                value-format="yyyy-MM"
                        ></el-date-picker>
                    </el-form-item>
                    <el-form-item label="录入日期" v-if="showmonth" >
                        <el-col :span="11">
                            <el-date-picker
                                    type="date"
                                    placeholder="开始日期"
                                    v-model="formData.start"
                                    style="width: 100%"
                                    value-format="yyyy-MM-dd"
                            ></el-date-picker>
                        </el-col>
                        <el-col class="line" :span="2">-</el-col>
                        <el-col :span="11">
                            <el-date-picker
                                    type="date"
                                    placeholder="结束日期"
                                    v-model="formData.end"
                                    style="width: 100%"
                                    value-format="yyyy-MM-dd"
                            ></el-date-picker>
                        </el-col>
                    </el-form-item>


                    <el-form-item label="时间范围" v-else>
                        <el-col :span="11">
                            <el-date-picker
                                    type="date"
                                    placeholder="开始日期"
                                    v-model="formData.start"
                                    style="width: 100%"
                                    value-format="yyyy-MM-dd"
                            ></el-date-picker>
                        </el-col>
                        <el-col class="line" :span="2">-</el-col>
                        <el-col :span="11">
                            <el-date-picker
                                    type="date"
                                    placeholder="结束日期"
                                    v-model="formData.end"
                                    style="width: 100%"
                                    value-format="yyyy-MM-dd"
                            ></el-date-picker>
                        </el-col>
                    </el-form-item>
                    <el-form-item>
                        <el-button type="primary" @click="toQuery">查询</el-button>
                        <el-button type="primary" plain @click="toPrint">报表打印</el-button>
                    </el-form-item>
                    <!-- 公共帮助组件 -->
                    <helpBtn :helpId="1015" />
                </el-form>

                <!-- 列表部分-职工列表 -->
                <el-table
                        v-if="tabletype == 1"
                        :data="tableData1"
                        :summary-method="getWorkSummaries"
                        show-summary
                        style="width: 100%"
                >
                    <el-table-column prop="rw" label="序号" width="55" align="center">
                    </el-table-column>
                    <el-table-column prop="knn001" label="编号" align="center">
                    </el-table-column>
                    <el-table-column prop="aac002" label="身份证号码" align="center">
                    </el-table-column>
                    <el-table-column prop="aae007" label="联系方式" align="center">
                    </el-table-column>
                    <el-table-column prop="aac003" label="姓名" align="center">
                    </el-table-column>
                    <el-table-column label="在职职工" align="center">
                        <el-table-column prop="z1" label="住院支出" align="center">
                        </el-table-column>
                        <el-table-column prop="z2" label="普通门诊支出" align="center">
                        </el-table-column>
                        <el-table-column prop="z3" label="特慢病门诊支出" align="center">
                        </el-table-column>
                    </el-table-column>
                    <el-table-column label="退休人员" align="center">
                        <el-table-column prop="t1" label="住院支出" align="center">
                        </el-table-column>
                        <el-table-column prop="t2" label="普通门诊支出" align="center">
                        </el-table-column>
                        <el-table-column prop="t3" label="特慢病门诊支出" align="center">
                        </el-table-column>
                    </el-table-column>
                    <el-table-column prop="sum" label="合计" align="center">
                    </el-table-column>
                    <el-table-column prop="aae006" label="支付银行账号" align="center">
                    </el-table-column>
                    <el-table-column prop="zs" label="附件张数" align="center">
                    </el-table-column>
                </el-table>
                <!-- 列表部分-家属列表 -->
                <el-table
                        v-else-if="tabletype == 2"
                        show-summary
                        :summary-method="getSummaries"
                        :data="tableData2"
                        style="width: 100%"
                >
                    <el-table-column prop="rw" label="序号" width="55" align="center">
                    </el-table-column>
                    <el-table-column prop="knn001" label="编号" align="center">
                    </el-table-column>
                    <el-table-column prop="aac002" label="身份证号码" align="center">
                    </el-table-column>
                    <el-table-column prop="aae007" label="联系方式" align="center">
                    </el-table-column>
                    <el-table-column prop="aac003" label="姓名" align="center">
                    </el-table-column>
                    <el-table-column label="基本医疗辅助" align="center">
                        <el-table-column prop="b1" label="普通门诊" align="center">
                        </el-table-column>
                        <el-table-column prop="b2" label="住院" align="center">
                        </el-table-column>
                    </el-table-column>
                    <el-table-column label="大病医疗补助" align="center">
                        <el-table-column prop="b3" label="特殊门诊" align="center">
                        </el-table-column>
                        <el-table-column prop="b4" label="住院" align="center">
                        </el-table-column>
                    </el-table-column>
                    <el-table-column prop="sum" label="合计" align="center">
                    </el-table-column>
                    <el-table-column prop="aae006" label="支付银行账号" align="center">
                    </el-table-column>
                    <el-table-column prop="zs" label="附件张数" align="center">
                    </el-table-column>
                </el-table>
                <!-- 列表部分-花名册列表 -->
                <table
                        v-else-if="tabletype == 3"
                        border="1"
                        cellpadding="10"
                        style="border-collapse: collapse; width: 100%; font-size: 14px"
                >
                    <tr>
                        <th rowspan="2">序号</th>
                        <th rowspan="2">单号</th>
                        <th rowspan="2">年度</th>
                        <th rowspan="2">身份证号码</th>
                        <th rowspan="2">姓名</th>
                        <th rowspan="2">医保手册号</th>
                        <th colspan="3">普通门诊</th>
                        <th colspan="3">特(慢)病</th>
                        <th colspan="3">住院</th>
                        <th rowspan="2">总计</th>
                    </tr>
                    <tr>
                        <th>总费用</th>
                        <th>可报金额</th>
                        <th>实际报销金额</th>
                        <th>总费用</th>
                        <th>可报金额</th>
                        <th>实际报销金额</th>
                        <th>总费用</th>
                        <th>可报金额</th>
                        <th>实际报销金额</th>
                    </tr>
                    <tr v-for="item in tableObj3.list" :key="item.rw">
                        <td>{{ item.rw }}</td>
                        <td>{{ item.knn001 }}</td>
                        <td>{{ item.aae001 }}</td>
                        <td>{{ item.aac002 }}</td>
                        <td>{{ item.aac003 }}</td>
                        <td>{{ item.kcc001 }}</td>
                        <td>{{ item.kni035 }}</td>
                        <td>{{ item.kni037 }}</td>
                        <td>{{ item.kni038 }}</td>
                        <td>{{ item.kni047 }}</td>
                        <td>{{ item.kni053 }}</td>
                        <td>{{ item.kni054 }}</td>
                        <td>{{ item.kni014 }}</td>
                        <td>{{ item.kni027 }}</td>
                        <td>{{ item.kni028 }}</td>
                        <td>{{ item.sum}}</td>
                    </tr>
                    <tr v-if="tableObj3.list.length >= 1">
                        <td colspan="5" style="text-align: center">小计：员工</td>
                        <td>{{ tableObj3.list.length }}</td>
                        <td>{{ tableObj3.sum.kni035 }}</td>
                        <td>{{ tableObj3.sum.kni037 }}</td>
                        <td>{{ tableObj3.sum.kni038 }}</td>
                        <td>{{ tableObj3.sum.kni047 }}</td>
                        <td>{{ tableObj3.sum.kni053 }}</td>
                        <td>{{ tableObj3.sum.kni054 }}</td>
                        <td>{{ tableObj3.sum.kni014 }}</td>
                        <td>{{ tableObj3.sum.kni027 }}</td>
                        <td>{{ tableObj3.sum.kni028 }}</td>
                        <td>{{ tableObj3.sum.sum }}</td>
                    </tr>
                    <tr v-for="item in tableObj4.list" :key="item.rw">
                        <td>{{ item.rw }}</td>
                        <td>{{ item.knn001 }}</td>
                        <td>{{ item.aae001 }}</td>
                        <td>{{ item.aac002 }}</td>
                        <td>{{ item.aac003 }}</td>
                        <td>{{ item.kcc001 }}</td>
                        <td>{{ item.kni035 }}</td>
                        <td>{{ item.kni037 }}</td>
                        <td>{{ item.kni038 }}</td>
                        <td>{{ item.kni047 }}</td>
                        <td>{{ item.kni053 }}</td>
                        <td>{{ item.kni054 }}</td>
                        <td>{{ item.kni014 }}</td>
                        <td>{{ item.kni027 }}</td>
                        <td>{{ item.kni028 }}</td>
                        <td>{{ item.sum }}</td>
                    </tr>
                    <tr v-if="tableObj4.list.length >= 1">
                        <td colspan="5" style="text-align: center">小计：供养直系亲属</td>
                        <td>{{ tableObj4.list.length }}</td>
                        <td>{{ tableObj4.sum.kni035 }}</td>
                        <td>{{ tableObj4.sum.kni037 }}</td>
                        <td>{{ tableObj4.sum.kni038 }}</td>
                        <td>{{ tableObj4.sum.kni047 }}</td>
                        <td>{{ tableObj4.sum.kni053 }}</td>
                        <td>{{ tableObj4.sum.kni054 }}</td>
                        <td>{{ tableObj4.sum.kni014 }}</td>
                        <td>{{ tableObj4.sum.kni027 }}</td>
                        <td>{{ tableObj4.sum.kni028 }}</td>
                        <td>{{ tableObj4.sum.sum }}</td>
                    </tr>
                    <tr>
                        <td colspan="5" style="text-align: center">合计</td>
                        <td>{{ tableObj3.list.length + tableObj4.list.length }}</td>
                        <td>{{ tableObj3.sum.kni035 + tableObj4.sum.kni035 }}</td>
                        <td>{{ tableObj3.sum.kni037 + tableObj4.sum.kni037 }}</td>
                        <td>{{ tableObj3.sum.kni038 + tableObj4.sum.kni038 }}</td>
                        <td>{{ tableObj3.sum.kni047 + tableObj4.sum.kni047 }}</td>
                        <td>{{ tableObj3.sum.kni053 + tableObj4.sum.kni053 }}</td>
                        <td>{{ tableObj3.sum.kni054 + tableObj4.sum.kni054 }}</td>
                        <td>{{ tableObj3.sum.kni014 + tableObj4.sum.kni014 }}</td>
                        <td>{{ tableObj3.sum.kni027 + tableObj4.sum.kni027 }}</td>
                        <td>{{ tableObj3.sum.kni028 + tableObj4.sum.kni028 }}</td>
                        <td>{{ tableObj3.sum.sum + tableObj4.sum.sum }}</td>
                    </tr>
                </table>
                <!-- 列表部分-医疗保险支出列表 -->
                <table
                        v-else
                        style="border-collapse: collapse; width: 100%; font-size: 14px"
                        cellpadding="10"
                        border="1"
                >
                    <tbody>
                    <tr>
                        <th id="lineTd" colspan="2">
                            <span style="margin-top: 20px">医疗类别</span>
                            <span style="">人员类别</span>
                        </th>
                        <th colspan="2">门诊</th>
                        <th colspan="2">特慢病</th>
                        <th colspan="2">住院</th>
                        <th colspan="2">金额合计</th>
                    </tr>
                    <tr>
                        <th></th>
                        <th v-if="formData.bblx == '15'" >人次</th>
                        <th v-if="formData.bblx == '16'" >人数</th>
                        <th>金额</th>
                        <th v-if="formData.bblx == '15'" >人次</th>
                        <th v-if="formData.bblx == '16'" >人数</th>
                        <th>金额</th>
                        <th v-if="formData.bblx == '15'" >人次</th>
                        <th v-if="formData.bblx == '16'" >人数</th>
                        <th>金额</th>
                        <th v-if="formData.bblx == '15'" >人次</th>
                        <th v-if="formData.bblx == '16'" >人数</th>
                        <th>金额</th>
                    </tr>
                    <tr>
                        <td rowspan="3" class="nopadding">
                            <table
                                    style="border-collapse: collapse; width: 100%"
                                    cellpadding="10"
                                    border="1"
                            >
                                <tr>
                                    <td rowspan="3" class="left">职 工</td>
                                    <td class="right">{{ tableData5[0].name }}</td>
                                </tr>
                                <tr>
                                    <td class="right">{{ tableData5[1].name }}</td>
                                </tr>
                                <tr>
                                    <td class="right">
                                        <b>{{ tableData5[2].name }}</b>
                                    </td>
                                </tr>
                            </table>
                        </td>
                        <td>{{ tableData5[0].t1 }}</td>
                        <td>{{ tableData5[0].t2 }}</td>
                        <td>{{ tableData5[0].t3 }}</td>
                        <td>{{ tableData5[0].t4 }}</td>
                        <td>{{ tableData5[0].t5 }}</td>
                        <td>{{ tableData5[0].t6 }}</td>
                        <td>{{ tableData5[0].t7 }}</td>
                        <td>{{ tableData5[0].t8 }}</td>
                    </tr>
                    <tr>
                        <td>{{ tableData5[1].t1 }}</td>
                        <td>{{ tableData5[1].t2 }}</td>
                        <td>{{ tableData5[1].t3 }}</td>
                        <td>{{ tableData5[1].t4 }}</td>
                        <td>{{ tableData5[1].t5 }}</td>
                        <td>{{ tableData5[1].t6 }}</td>
                        <td>{{ tableData5[1].t7 }}</td>
                        <td>{{ tableData5[1].t8 }}</td>
                    </tr>
                    <tr>
                        <td>{{ tableData5[2].t1 }}</td>
                        <td>{{ tableData5[2].t2 }}</td>
                        <td>{{ tableData5[2].t3 }}</td>
                        <td>{{ tableData5[2].t4 }}</td>
                        <td>{{ tableData5[2].t5 }}</td>
                        <td>{{ tableData5[2].t6 }}</td>
                        <td>{{ tableData5[2].t7 }}</td>
                        <td>{{ tableData5[2].t8 }}</td>
                    </tr>
                    <tr>
                        <td rowspan="3" class="nopadding">
                            <table
                                    style="border-collapse: collapse; width: 100%"
                                    cellpadding="10"
                                    border="1"
                            >
                                <tr>
                                    <td rowspan="3" class="left">再就业</td>
                                    <td class="right">{{ tableData5[3].name }}</td>
                                </tr>
                                <tr>
                                    <td class="right">{{ tableData5[4].name }}</td>
                                </tr>
                                <tr>
                                    <td class="right">
                                        <b>{{ tableData5[5].name }}</b>
                                    </td>
                                </tr>
                            </table>
                        </td>
                        <td>{{ tableData5[3].t1 }}</td>
                        <td>{{ tableData5[3].t2 }}</td>
                        <td>{{ tableData5[3].t3 }}</td>
                        <td>{{ tableData5[3].t4 }}</td>
                        <td>{{ tableData5[3].t5 }}</td>
                        <td>{{ tableData5[3].t6 }}</td>
                        <td>{{ tableData5[3].t7 }}</td>
                        <td>{{ tableData5[3].t8 }}</td>
                    </tr>
                    <tr>
                        <td>{{ tableData5[4].t1 }}</td>
                        <td>{{ tableData5[4].t2 }}</td>
                        <td>{{ tableData5[4].t3 }}</td>
                        <td>{{ tableData5[4].t4 }}</td>
                        <td>{{ tableData5[4].t5 }}</td>
                        <td>{{ tableData5[4].t6 }}</td>
                        <td>{{ tableData5[4].t7 }}</td>
                        <td>{{ tableData5[4].t8 }}</td>
                    </tr>
                    <tr>
                        <td>{{ tableData5[5].t1 }}</td>
                        <td>{{ tableData5[5].t2 }}</td>
                        <td>{{ tableData5[5].t3 }}</td>
                        <td>{{ tableData5[5].t4 }}</td>
                        <td>{{ tableData5[5].t5 }}</td>
                        <td>{{ tableData5[5].t6 }}</td>
                        <td>{{ tableData5[5].t7 }}</td>
                        <td>{{ tableData5[5].t8 }}</td>
                    </tr>
                    <tr>
                        <td>{{ tableData5[6].name }}</td>
                        <td>{{ tableData5[6].t1 }}</td>
                        <td>{{ tableData5[6].t2 }}</td>
                        <td>{{ tableData5[6].t3 }}</td>
                        <td>{{ tableData5[6].t4 }}</td>
                        <td>{{ tableData5[6].t5 }}</td>
                        <td>{{ tableData5[6].t6 }}</td>
                        <td>{{ tableData5[6].t7 }}</td>
                        <td>{{ tableData5[6].t8 }}</td>
                    </tr>
                    <tr>
                        <td>{{ tableData5[7].name }}</td>
                        <td>{{ tableData5[7].t1 }}</td>
                        <td>{{ tableData5[7].t2 }}</td>
                        <td>{{ tableData5[7].t3 }}</td>
                        <td>{{ tableData5[7].t4 }}</td>
                        <td>{{ tableData5[7].t5 }}</td>
                        <td>{{ tableData5[7].t6 }}</td>
                        <td>{{ tableData5[7].t7 }}</td>
                        <td>{{ tableData5[7].t8 }}</td>
                    </tr>
                    </tbody>
                </table>
                <!-- 打印弹窗 -->
                <workerPrint
                        ref="workerPrint"
                        :visible="workerPrint.visible"
                        :remoteClose="closePrint"
                />
                <familyPrint
                        ref="familyPrint"
                        :visible="familyPrint.visible"
                        :remoteClose="closePrint"
                />
                <rosterPrint
                        ref="rosterPrint"
                        :visible="rosterPrint.visible"
                        :remoteClose="closePrint"
                />
                <allPrint
                        ref="allPrint"
                        :visible="allPrint.visible"
                        :remoteClose="closePrint"
                />
            </div>
        </template>
    </div>

    <script>

        var vm = new Vue({
           el:"#app",
            data() {
                return {
                    formData: {
                        bblx: "",
                        start: "",
                        end: "",
                        month: "",
                    },
                    parmsData : {},
                    searchDataList:[],
                    options: [],
                    showmonth: false,
                    tabletype: 1,
                    tableData1: [],
                    tableData2: [],
                    tableObj3: {
                        list: [],
                        sum: {},
                    },
                    tableObj4: {
                        list: [],
                        sum: {},
                    },
                    tableData5: [],
                    // 打印凭证弹窗
                    workerPrint: {
                        visible: false,
                    },
                    familyPrint:{
                        visible: false,
                    },
                    rosterPrint:{
                        visible: false,
                    },
                    allPrint:{
                        visible: false,
                    }
                };
            },
            created() {
               this.parmsData = getParams();
               this.formData.bblx = this.parmsData.bblx;
               this.choosebblx(this.formData.bblx);
               this.getFormData();
            },
            methods: {
                // 获取查询条件
                async getFormData() {
                    const res = await api.postBody(
                        "/admin/api/rpc/ReportPrintingController/conditionalRendering"
                    );
                    if (res.code == 1) {
                        console.log(res.data);
                        this.formData.start = res.data.start;
                        this.formData.end = res.data.end;
                        this.options = res.data.typeList;
                    } else {
                        this.$message.error(res.msg);
                    }
                },
                // 下拉框改变触发
                choosebblx(val) {
                    if (val == 15) {
                        this.showmonth = true;
                    }else{
                        this.showmonth = false;
                    }
                },
                // 获取表格数据
                async getData() {
                    const params = {
                        type: this.formData.bblx,
                        start: this.formData.start,
                        end: this.formData.end,
                    };
                    load();
                    const res = await api.postBody(
                        "/admin/api/rpc/ReportPrintingController/reportListdata",
                        params
                    );
                    layer.closeAll();
                    if (res.code == 1) {
                        if (parseInt(params.type) <= 6) {
                            // 职工报表
                            this.tableData1 = res.data.list.map((e) => {
                                const sum1 = e.t1 + e.t2 + e.t3 + e.z1 + e.z2 + e.z3;
                                return {
                                    aac002: e.aac002,
                                    aac003: e.aac003,
                                    aae006: e.aae006,
                                    aae007: e.aae007,
                                    knn001: e.knn001,
                                    rw: e.rw,
                                    t1: e.t1,
                                    t2: e.t2,
                                    t3: e.t3,
                                    z1: e.z1,
                                    z2: e.z2,
                                    z3: e.z3,
                                    zs: e.zs,
                                    sum: sum1,
                                };
                            });
                            this.tabletype = 1;
                            this.searchDataList = res.data;
                        } else if (parseInt(params.type) <= 9) {
                            // 家属报表
                            this.tableData2 = res.data.list.map((e) => {
                                const sum2 = e.b1 + e.b2 + e.b3 + e.b4;
                                return {
                                    aac002: e.aac002,
                                    aac003: e.aac003,
                                    aae006: e.aae006,
                                    aae007: e.aae007,
                                    knn001: e.knn001,
                                    rw: e.rw,
                                    b1: e.b1,
                                    b2: e.b2,
                                    b3: e.b3,
                                    b4: e.b4,
                                    zs: e.zs,
                                    sum: sum2,
                                };
                            });
                            this.tabletype = 2;
                            let startStr = params.start.split("-")[0]+"年"+params.start.split("-")[1]+"月"+params.start.split("-")[2]+"日";
                            let endStr = params.end.split("-")[0]+"年"+params.end.split("-")[1]+"月"+params.end.split("-")[2]+"日";
                            res.data.qzrq = startStr+"至"+endStr;
                            this.searchDataList = res.data;
                        } else if (parseInt(params.type) <= 14) {
                            // 花名册报表
                            this.tableObj3 = res.data[0];
                            this.tableObj4 = res.data[1];
                            this.tabletype = 3;
                            let database = res.data;
                            let startStr = params.start.split("-")[0]+"年"+params.start.split("-")[1]+"月"+params.start.split("-")[2]+"日";
                            let endStr = params.end.split("-")[0]+"年"+params.end.split("-")[1]+"月"+params.end.split("-")[2]+"日";
                            database.title = startStr+"至"+endStr;
                            if(params.type == 10){
                                database.title = database.title+"录入花名册";
                            }else if(params.type == 11){
                                database.title = database.title+"复核花名册";
                            }else if(params.type == 12){
                                database.title = database.title+"稽核花名册";
                            }else if(params.type == 13){
                                database.title = database.title+"中心领导审核花名册";
                            }else if(params.type == 14){
                                database.title = database.title+"拨付通过报销花名册";
                            }
                            this.searchDataList = database;
                        } else {
                            if(this.formData.bblx == '15' || this.formData.bblx == "16"){
                                this.getTablelast();
                            }else{
                                this.$message.error("请选择月份");
                            }
                        }
                    } else {
                        this.$message.error(res.msg);
                    }
                },
                // 获取医保支出统计表
                async getTablelast() {
                    const params = {
                        start:this.formData.start,
                        end:this.formData.end,
                        type:this.formData.bblx
                    };
                    if(this.formData.month != "" && this.formData.month != null){
                        let arr = this.formData.month.split("-");
                        params.year = arr[0];
                        params.mm = arr[1];
                    }
                    load();
                    const res = await api.queryBody(
                        "/admin/api/rpc/ReportPrintingController/listData",
                        params
                    );
                    layer.closeAll();
                    if (res.code == 1) {
                        let arr = [];
                        for (let i in res.data) {
                            arr.push(res.data[i]);
                        }
                        this.tableData5 = arr;
                        this.tabletype = 4;
                        let datat = {list:arr,title:"玉门油田补充医疗保险支出统计表",title_qj:"("+params.start+"--"+params.end+")",bblx:this.formData.bblx};
                        if(this.formData.month != "" && this.formData.month != null){
                            datat.title = params.year+"年"+params.mm+"月医疗保险支出统计表";
                            datat.title_qj = "";
                        }

                        this.searchDataList = datat;
                    } else {
                        this.$message.error(res.msg);
                    }
                },
                toQuery() {
                    if (this.formData.bblx == "") {
                        this.$message.error("请选择报表类别");
                    } else {
                        this.getData();
                    }
                },
                getWorkSummaries(param) {
                    const { columns, data } = param;
                    const sums = [];
                    columns.forEach((column, index) => {
                        if (index === 0) {
                            sums[index] = "合计";
                            return;
                        } else if (index < 5 || index === 12) {
                            sums[index] = "";
                            return;
                        }
                        const values = data.map((item) => Number(item[column.property]));
                        if (!values.every((value) => isNaN(value))) {
                            sums[index] = values.reduce((prev, curr) => {
                                const value = Number(curr);
                                if (!isNaN(value)) {
                                    return prev + curr;
                                } else {
                                    return prev;
                                }
                            }, 0);
                            // sums[index] += ' 元';
                        } else {
                            sums[index] = "";
                        }
                    });
                    return sums;
                },
                getSummaries(param) {
                    const { columns, data } = param;
                    const sums = [];
                    columns.forEach((column, index) => {
                        if (index === 0) {
                            sums[index] = "合计";
                            return;
                        } else if (index < 5 || index === 10) {
                            sums[index] = "";
                            return;
                        }
                        const values = data.map((item) => Number(item[column.property]));
                        if (!values.every((value) => isNaN(value))) {
                            sums[index] = values.reduce((prev, curr) => {
                                const value = Number(curr);
                                if (!isNaN(value)) {
                                    return prev + curr;
                                } else {
                                    return prev;
                                }
                            }, 0);
                            // sums[index] += ' 元';
                        } else {
                            sums[index] = "";
                        }
                    });
                    return sums;
                },
                // 关闭打印组件
                closePrint() {
                    this.workerPrint.visible = false;
                    this.familyPrint.visible = false;
                    this.rosterPrint.visible = false;
                    this.allPrint.visible = false;
                },
                printbaobiaohtml(url){
                    let btn = {
                        btn: ['打印预览', '取消']
                        , yes: function (index, layero) {
                            //按钮【按钮一】的回调
                            let win = getTopIframe(layero);
                            win.vm.printHtml();
                        }
                        , btn2: function (index, layero) {
                            //按钮【按钮二】的回调
                            //return false 开启该代码可禁止点击该按钮关闭
                        }
                    };
                    top.f_layer_open_get(url, "90%", "80%", function () {
                    }, btn, "报表打印",this.searchDataList);
                },

                // 报表打印
                async toPrint() {
                    console.log(this.tabletype);
                    if(this.tabletype == 1){
                        this.printbaobiaohtml("/admin/html/module/yumenyoutian/report/print1.html");
                    }else if(this.tabletype == 2){
                        this.printbaobiaohtml("/admin/html/module/yumenyoutian/report/print2.html");
                    }else if(this.tabletype == 3){
                        this.printbaobiaohtml("/admin/html/module/yumenyoutian/report/print3.html");
                    }else{
                        this.printbaobiaohtml("/admin/html/module/yumenyoutian/report/yiliaobaoxianzhichu.html");
                    }
                    // if (this.tabletype == 4) {
                    //   let arr = this.formData.month.split("-");
                    //   const params = {
                    //     year: arr[0],
                    //     mm: arr[1],
                    //   };
                    //   const res = await api.queryBody(
                    //     '/admin/api/rpc/ReportPrintingController/expExcelPrint',
                    //     params
                    //   )
                    //   if(res.code==1){
                    //     console.log(res);
                    //     window.location.href = res.data;
                    //   }else{
                    //     this.$message.error(res.msg)
                    //   }
                    // } else {
                    //   const params = {
                    //     type: this.formData.bblx,
                    //     start: this.formData.start,
                    //     end: this.formData.end,
                    //   };
                    //   const res = await api.postBody(
                    //     "/admin/api/rpc/ReportPrintingController/print",
                    //     params
                    //   );
                    //   if (res.code == 1) {
                    //     console.log(res);
                    //     window.location.href = res.data;
                    //   } else {
                    //     this.$message.error(res.msg);
                    //   }
                    // }
                },
            },
        });
    </script>
</body>
</html>